package problems.solved;

import utils.Fibiterator;

public class Problem2 {
	public static void main(String[] args) {
		int sum = 0;
		Fibiterator fibiterator = new Fibiterator();
		while(fibiterator.hasNext()) {
			int n = (int)fibiterator.next().longValue();
			if (n > 4000000) break;
			if (n%2 == 0) {
				sum += n;
			}
		}
		System.out.println("Sum of all even Fibonacci sequence numbers under 4.000.000 is " + sum); // 4613732
	}
}
